﻿using System;
using HelloworldCSharp.lopcoban;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HelloworldCSharp
{
    class Program // cThang
    {
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello world");
       //     System.Threading.Thread.Sleep(2000);

            Console.WriteLine("Xin chao");
            Console.WriteLine("Tam biet");

            int var1 = 10;
            int var2 = 20;

            if (var1 > var2)
            {
                System.Console.WriteLine(var1 + " > " + var2);
            }
            else 
            {
                System.Console.WriteLine( "bien {0} <= {1}", var1, var2);
            }

            System.DateTime curentDateTime = System.DateTime.Now;
            ThoiGian t = new ThoiGian(curentDateTime);
            t.displayTime();

            int a = 10;
            int b = 20;
            
            t.truyenThamSo(a , b);
            System.Console.WriteLine("a = {0}, b = {1}", a, b);
            t.truyenThamChieu(ref a, ref b);
            System.Console.WriteLine("a = {0}, b = {1}", a, b);

            // chuong 5 ke thua da hinh
            ListBox listBox = new ListBox(1, 2, "myListbox");
            listBox.drawWindow();
            

            // da hinh
            Window[] windows = new Window[3];
            windows[0] = new Window(1, 2);
            windows[1] = new ListBox(3, 4, "my list box");
            windows[2] = new Window(5, 6);

            for (int i = 0; i < windows.Length; i++) {
                windows[i].drawWindow();
            }

            // boxing, unboxing
            int val = 1;
            Object o = val;
            System.Console.WriteLine(o);

            int intVal = (int)o;
            System.Console.WriteLine(intVal);

            // chuong 7 cau truc
            Location loc1 = new Location(200, 300);
            System.Console.WriteLine("loc1 {0}", loc1);

            Program program = new Program();
            program.myFunc(loc1);

            System.Console.WriteLine("loc1 {0}", loc1);

            TimerDemo timer = new TimerDemo();
            timer.displayTime();

            while (Console.Read() != 'q')
            {
                ; // khong lam gi het            
            }
            
            //System.Threading.Thread.Sleep(5000);
        }

        public void myFunc(Location loc) {
            loc.x = 50;
            loc.y = 100;
            Console.WriteLine("Loc: {0}", loc);
        }




     
    }
}
